package com.xxzb.pack0823.线程同步.强化训练题;

import java.util.concurrent.TimeUnit;

public class Test1 extends Thread {
    /**
     * 带有参数的构造方法
     * @param s1
     */
    public Test1(String s1) {
        super(s1);
    }
    @Override
    public void run() {
        for (int i = 1; i <=100; i++) {
            System.out.println(Thread.currentThread().getName()+":"+i );
//            Thread.yield();
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        /*try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
//        Thread.yield();
    }

}
